package cc.linker.steplink.crm.merchanth5.pojo;


import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class H5SignPo {
    //主键id
    private Long id;
    //机构ID
    private String orgId;
    //当天年月日
    private String day;
    //用户ID
    private String customerId;
    //该用户今天是否已签到 1:是，0:否
    private Integer isSgined;
    //该用户今天是否已提醒 1:是，0:否
    private Integer isRemind;
    //创建人id，机构orgId，小b用户id
    private String createUser;
    //最后修改时间
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime = new Date();
    //循环周期1-999天
    private String cycle;
    //循环周期是否选择1：是，0：否
    private Integer ifCycle;
    //积分
    private String score;
    //积分是否选择1：是，0：否
    private Integer ifScore;
    //成长值
    private String growth;
    //成长值是否选择1：是，0：否
    private Integer ifGrowth;
    //优惠券是否选择1：是，0：否
    private Integer ifCoupons;
    //优惠券
    private String coupons;
    private ArrayList<Map<String,Object>> couponsArr;

    public ArrayList<Map<String, Object>> getCouponsArr() {
        return JSON.parseObject(coupons,ArrayList.class);
    }
    public void setCouponsArr(ArrayList<Map<String, Object>> couponsArr) {
        this.couponsArr = couponsArr;
        this.coupons = JSON.toJSONString(couponsArr);
    }
    //规则说明
    private String rule;
    //是否提示，1：是，0：否
    private Integer ifTip;
    //连续签到奖励JSON eg:
    // [{"day":"1","score":"1","growth":"1","couponIds":"abc,def,ghi"},{"day":"2","score":"","growth":"1","couponIds":"abc,def,ghi"},{"day":"3","score":"10","growth":"","couponIds":""}]
    private ArrayList<Map<String,Object>> seriesRewardArr;

    private String seriesReward;
    public void setSeriesRewardArr(ArrayList<Map<String, Object>> seriesRewardArr) {
        this.seriesRewardArr = seriesRewardArr;
        this.seriesReward = JSON.toJSONString(seriesRewardArr);
    }
    public ArrayList<Map<String, Object>> getSeriesRewardArr() {
        return JSON.parseObject(seriesReward,ArrayList.class);
    }
    //全局开关，1：开，0：关
    private Integer status;
}
